package game;

import java.sql.SQLException;

import org.lwjgl.input.Mouse;
import org.newdawn.slick.Color;
import org.newdawn.slick.Font;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.TrueTypeFont;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

import Netzwerk.DB_Zugriff;

public class Menu extends BasicGameState{
	
	private Font font;
	private Image img;

	public Menu(int state){
		
	}
	

	@Override
	public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
		this.font =new TrueTypeFont (new java.awt.Font("Cooper Black",0,18),false );
		img = new Image("/Graphics/title.gif");
		
	}

	@Override
	public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
		
		g.setFont(this.font);
		g.setColor(Color.white);
		g.drawString("Singleplayer", 650, 300);
		g.drawString("Schneller Multiplayer", 650, 330);
		g.drawString("Multiplayer", 650, 360);
		g.drawString("Map-Editor", 650, 390);
		img.draw(150,175,330,360);
		
	}

	@Override
	public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
		
		Input in = gc.getInput();
		
		int xpos = Mouse.getX();
		int ypos = Mouse.getY();
		if((xpos>650 && xpos<760) && (ypos<Main.sizey-300 && ypos>Main.sizey-320) && in.isMouseButtonDown(0)){
			//on singleplayer
			sbg.addState(new Mod(6, true));
			sbg.getState(6).init(gc, sbg);
			sbg.enterState(6);
		}
		if((xpos>650 && xpos<770) && (ypos<Main.sizey-330 && ypos>Main.sizey-350) && in.isMouseButtonDown(0)){
			//on schneller Multiplayer
			sbg.addState(new Mod(6, false, 2));
			sbg.getState(6).init(gc, sbg);
			sbg.enterState(6);
		}
		
		if((xpos>650 && xpos<755) && (ypos<Main.sizey-360 && ypos>Main.sizey-380) && in.isMouseButtonDown(0)){
			//on multiplayer
			sbg.enterState(3);
		}
		if((xpos>650 && xpos<752) && (ypos<Main.sizey-390 && ypos>Main.sizey-410)  && in.isMouseButtonDown(0)){
			sbg.enterState(8);
		}
		
	}

	@Override
	public int getID() {
		// TODO Auto-generated method stub
		return 0;
	}

}
